#ifndef CONCUSHARE_H_
#define CONCUSHARE_H_

#include <iostream>
#include <fstream>
#include <list>
#include <map>

#include "FileServer.h"
#include "FileShare.h"
#include "OnlineUsers.h"
#include "SharedFileList.h"
#include "util/util.h"

#include "test/TestServer.h"

class Console;
#include "console/Console.h"

class ConcuShare {

private:
	Console	*console;
	int 	 master_pid;
	int		 server_pid;
	bool 	 quit;

	std::list<std::string> list_files_shared;

	OnlineUsers		userManager;
	FileServer      fileServer;
	//TestServer      fileServer;
	FileShare 		shared;

	std::list<int>	list_pids;

	void start_server();
	void start_console();
	bool file_exist(const std::string& path);
	void create_files_list(SharedFileList& shared_files, bool with_id);

public:
	ConcuShare();
	~ConcuShare();
	void start_application();
	void stop_application();

	void share_file(const std::string& path);
	void unshare_file(unsigned int num_file);
	void download_file(unsigned int num_file);
	const std::list<std::string>& get_files_shared();
	const std::list<std::string>& get_my_files_shared();
};

#endif /* CONCUSHARE_H_ */
